<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class UserinserttttRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'rec'=>'required',
            'phone'=>'required|regex:/\d{11}/',
            'email'=>'required|email',
            'sheng'=>'required',
            'shi'=>'required',
            'xian'=>'required',
            'addr'=>'required',
        ];
    }

    /**
     * 获取已定义验证规则的错误消息。
     *
     * @return array
     */
    public function messages()
    {
        return [
            'rec.required' => '收件人不能为空',
            'phone.required' => '联系电话不能为空',
            'email.required' => '邮箱不能为空',
            
            'phone.regex'  => '联系电话格式不正确',
            'email.email'  => '邮箱格式不正确',
            'sheng' => '所在地区不能为空'
            'shi' => '所在地区不能为空'
            'xian' => '所在地区不能为空'
            'addr' => '详细地址不能为空'
        ];
    }


}
